#!/bin/bash

set -eu
cd `dirname $0`

DIST_DIR=../dist
WASM_DIR=../wasm
SCRIPT_NAME=pyxel.js

mkdir -p $WASM_DIR
rm -f $WASM_DIR/*-emscripten_*.whl
cp -f $DIST_DIR/*-emscripten_*.whl $WASM_DIR
WHEEL_NAME=`cd $WASM_DIR && find *.whl`
sed -i -e "s#\\(PYXEL_WHEEL_PATH =\\).*;#\\1 \\\"$WHEEL_NAME\\\";#" $WASM_DIR/$SCRIPT_NAME
rm -f $WASM_DIR/$SCRIPT_NAME-e
